package book.oo.coverhide;

public class CoverHideTest {
    public static void main(String[] args) {
        //先测试继承时变量的覆盖与隐藏问题
        Child child=new Child();
        System.out.println("child name:"+child.name+";age:"+child.age+";kind:"+child.kind);//此时得到的都是child类的变量
        //将child类型转换成Parent对象
        Parent parent=child;
        System.out.println("转换成Parent后name:"+parent.name+";age:"+parent.age+";kind:"+parent.kind);
        //再测试继承时方法的覆盖与隐藏问题
        System.out.println();
        child.getName();
        child.getKind();
        parent.getName();
        parent.getKind();
    }
}
